<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<base href="<%=basePath%>">
	<title>hr-m-s</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/style.css" >
</head>
<body>
<form id="authority_group_update" name="authority_group_update" method="post" action="authorityGroup!update">
  <table width="900" border="1" cellpadding="0" cellspacing="0" align="center">
    <tr>
      <th colspan="4" scope="col">修改权限组信息</th>
    </tr>
    <tr>
      <td width="80">组名</td>
      <td width="720" colspan="2">
        <input name="authorityGroupName" type="text" id="authorityGroupName" size="50" maxlength="50" value='<s:property value="authorityGroup.authorityGroupName"/>'/>
      </td>
      <td width="100">权限组名称</td>
    </tr>
    <tr>
      <td rowspan='<s:property value="parentMenuVO.size() + 1"/>'>权限</td>
      <td colspan="2">勾选复选框分配权限</td>
      <td rowspan='<s:property value="parentMenuVO.size() + 1"/>'>请合理分配权限</td>
    </tr>
	  <s:iterator value="parentMenuVO" var="pm">
		  <tr>
	      	<td width="80"><s:property value="parentMenuName"/></td>
	        <td width="640">
	          <s:iterator value="childMenus" var="cm">
	          	<s:set var="show_pm" value="#pm.parentMenuID"/>
	          	<s:set var="show_cm" value="#cm.childMenuID"/>
	          	<s:set var="show_checkbox_key" value="0"/>
			    <s:iterator value="authorityPrivilegeList" var="ap">
	  			  <s:set var="show_ap_pm" value="#ap.parentMenuID"/>
	  			  <s:set var="show_ap_cm" value="#ap.childMenuID"/>
	  			  <s:if test="#show_pm==#show_ap_pm && #show_cm==#show_ap_cm">
	  			  	<s:set var="show_checkbox_key" value="1"/>
	  			  </s:if>
	  			</s:iterator>
	  			<s:if test="#show_checkbox_key == 1">
	  			  <input type="checkbox" id="privilegeList" name="privilegeList" value='<s:property value="#show_pm"/>,<s:property value="#show_cm"/>' checked="checked"/>
			   	  <s:property value="#cm.childMenuName"/>
	  			</s:if>
	  			<s:else>
	  			  <input type="checkbox" id="privilegeList" name="privilegeList" value='<s:property value="#show_pm"/>,<s:property value="#show_cm"/>' />
			   	  <s:property value="#cm.childMenuName"/>
	  			</s:else>
			  </s:iterator>
	        </td>
	      </tr>
	  </s:iterator>
	  
    <tr>
      <td>是否启用</td>
      <td colspan="2">
        <select name="authorityGroupDisplayKey" id="authorityGroupDisplayKey">
          <option value="1">启用</option>
          <option value="0">停用</option>
        </select></td>
      <td>用于控制显示</td>
    </tr>
    <tr>
      <td colspan="4"><input type="hidden" name="authorityGroupID" value='<s:property value="authorityGroup.authorityGroupID"/>'/>
        <input type="submit" name="Submit" value="修改" onclick="return checkForm();" />
		<input type="reset" name="Reset" value="重置" onclick="javascript:return confirm('确定要重新填写部门信息吗？');" />
	  </td>
    </tr>
  </table>
</form>
<script type="text/javascript">
	function checkForm(){
		var name = document.getElementById("authorityGroupName");
		if (name.value == ""){
			alert("请输入权限组名称！");
			name.focus();
			return false;
		}
		return true;
	}
</script>
</body>
</html>
